import '@/assets/css/global.css'; // 引入全局样式表
import axios from 'axios';
import Vue from 'vue';
import TreeTable from 'vue-table-with-tree-grid';
import App from './App.vue';
import router from './router';
import store from './store';
import '@/util/index'         // 配置文件
import VueQuillEditor from 'vue-quill-editor'     // 富文本编辑器
// 导入进度条
import nprogress from 'nprogress';

// 富文本注册
Vue.use(VueQuillEditor);
Vue.component('tree-table', TreeTable);
Vue.prototype.$http = axios;
Vue.config.productionTip = false
// 请求根路径
axios.defaults.baseURL = 'http://127.0.0.1:8888/api/private/v1/';
// 请求拦截器（展示）
axios.interceptors.request.use(
  config => {
    nprogress.start();
    const token = window.sessionStorage.getItem('token')
    config.headers.Authorization = token
    return config
  },
  error => {
    return Promise.reject(error)
})
// 响应拦截器(隐藏)
axios.interceptors.response.use( config => {
  nprogress.done();
  return config;
})

new Vue({
  router,
  store,
  render: h => h(App)
}).$mount('#app')
